﻿using DryIoc;
using Prism.DryIoc;
using Prism.Ioc;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Wpf.Netdisk.Services.Common;
using Wpf.Netdisk.Services.Implement;
using Wpf.Netdisk.Services.Interface;
using Wpf.Netdisk.ViewModels;
using Wpf.Netdisk.ViewModels.Base;
using Wpf.Netdisk.ViewModels.ChildrenListItem;
using Wpf.Netdisk.ViewModels.ChildrenListItem.TransfersView;
using Wpf.Netdisk.ViewModels.MainListItem;
using Wpf.Netdisk.Views;
using Wpf.Netdisk.Views.ChildrenListItem;
using Wpf.Netdisk.Views.ChildrenListItem.TransfersView;
using Wpf.Netdisk.Views.MainListItem;

namespace Wpf.Netdisk
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainView>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.GetContainer()
                .Register<HttpRestClient>(made: Parameters.Of.Type<string>(serviceKey: "webUrl"));
            containerRegistry.GetContainer().RegisterInstance(@"http://localhost:5610/", serviceKey: "webUrl");
            //注入接口
            containerRegistry.Register<IDialogHostService, DialogHostService>();

            containerRegistry.Register<INetdiskFolderService, NetdiskFolderService>();
            containerRegistry.Register<INetdiskFileService, NetdiskFileService>();
             
            containerRegistry.RegisterForNavigation<IndexView, IndexViewModel>();
            containerRegistry.RegisterForNavigation<TransfersView, TransfersViewModel>();

            containerRegistry.RegisterForNavigation<TrayArrowDownView, TrayArrowDownViewModel>();
            containerRegistry.RegisterForNavigation<TrayArrowUpView, TrayArrowUpViewModel>();
            containerRegistry.RegisterForNavigation<CheckCircleOutlineView, CheckCircleOutlineViewModel>();

            
            containerRegistry.RegisterForNavigation<RecentView, RecentViewModel>();
            containerRegistry.RegisterForNavigation<MyFolderView, MyFolderViewModel>();
            containerRegistry.RegisterForNavigation<FileView, FileViewModel>();
        }
    }
}
